//
//  MZFormatterItemView.m
//  MZBaseDemo
//
//  Created by Chris Yang on 2016/12/6.
//  Copyright © 2016年 Chris Yang. All rights reserved.
//

#import "MZDemoSupprot.h"
#import "UIView+MZLayout.h"

#import "MZFormatterItemView.h"

@implementation MZFormatterItemView

- (id)init {
    
    self = [super init];
    
    if (self) {
        [self configSelf];
        [self allocSubviews];
        [self configSubviews];
        [self positionSubviews];
    }
    
    return self;
}

- (void)configSelf {
    
}

- (void)allocSubviews {
    
    _titleLabel = [MZDemoSupprot mzDemoLabel];
    _valueLabel = [MZDemoSupprot mzDemoLabel];
}

- (void)configSubviews {
    
    /* Title Lable */
    [_titleLabel setText:@"Title"];
    
    /* Value Label */
    [_valueLabel setText:@"Value"];
    
    [self addSubview:_titleLabel];
    [self addSubview:_valueLabel];
}

- (void)positionSubviews {
    
    CGRect tmpRect = CGRectZero;
    
    /* Title Lable */
    tmpRect = self.bounds;
    tmpRect.size.width = 80;
    [_titleLabel setFrame:tmpRect];
    
    /* Value Label */
    tmpRect = self.bounds;
    tmpRect.origin.x = [_titleLabel mzGetXForBrotherViewToLeftWithSpace:10];
    tmpRect.size.width -= tmpRect.origin.x;
    [_valueLabel setFrame:tmpRect];
}

- (void)layoutSubviews {
    [self positionSubviews];
}

#pragma mark - Target-Action Pair

- (void)buttonClicked:(UIButton *)button {
    
}

#pragma mark - MISC

#pragma mark - User Interface

- (void)updateTitle:(NSString *)title {
    _titleLabel.text = title;
}

- (void)updateValue:(NSString *)value {
    _valueLabel.text = value;
}

@end
